package secretaryGUI;

import java.awt.Color;
import java.sql.SQLException;

import secretary.defineSemester;
import basic.ClientConsole;
import com.sun.rowset.CachedRowSetImpl;
import flexibility.userData;
import guiCode.secretaryScreenCode;


public class getAllOtherStudents {

	secretaryScreenCode ssc;
	secretaryAlerts sa = new secretaryAlerts();
	updateLowerTableEntries ULTE = new updateLowerTableEntries();
	userData getStudents = new userData();
	defineSemester ds = new defineSemester();
	
	public void click(secretaryScreenCode code, createSecretaryWindow csw, int classToEdit, ClientConsole secretaryConnection, CachedRowSetImpl crs){
		ssc = code;
		int semester = 0;
		//csw.btnRemoveStudentFrom.setForeground(Color.BLACK);
		//csw.btnAddStudentTo.setForeground(Color.RED);
		
		//this will bring all the students that are not in this class but in the same semester
		//if this is the current semester, all the students from the next semester
		//if this is the next semester, all the students from the current semester
		//all the students from semester 0 (just registered)
		
		getStudents.deleteAll();
		getStudents.addData(96);
		getStudents.addData(0);
		secretaryConnection.acceptMsg(getStudents);
		crs = secretaryConnection.getResults();
		
		getStudents.deleteAll();
		getStudents.addData(88);
		getStudents.addData(1);
		getStudents.addData(classToEdit);
		semester = ds.identify(ssc.getSemesterForEdit(), secretaryConnection, crs);
		getStudents.addData(semester);
		if(ssc.getSemesterForEdit()==0){
			semester = ds.identify(1, secretaryConnection, crs);
		}
		else{
			semester = ds.identify(0, secretaryConnection, crs);
		}
		getStudents.addData(semester);
		secretaryConnection.acceptMsg(getStudents);
		crs = secretaryConnection.getResults();
			ULTE.update(csw, crs);
			csw.table_1.setEnabled(true);
		}
		
	}

